﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;

    public class JSAction
    {
        public JSAction()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }
        public static void alert(string msg, Page page)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "alert", string.Format("alert('{0}');", msg), true);
        }
        public static void redirectUrl(string msg, string url, Page page)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "reload", string.Format("alert('{0}');window.location.href='{1}';",msg, url), true);
        }
        public static void parentRedirectUrl(string url, Page page)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "reload", string.Format("window.parent.location.href='{0}';", url), true);
        }
        public static void parentRedirectUrl(string msg, string url, Page page)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "reload", string.Format("alert('{0}');window.parent.location.href='{1}';", msg, url), true);
        }
    }
